import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import router from "@/router/index.js";
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { createPinia } from 'pinia'
import './permission' // permission control
import mitt from "mitt"
// 建一个 mitt 实例作为事件总线
const emitter = mitt();
const app= createApp(App)
// 将事件总线添加到全局属性，使其可以在任何组件中通过 this.$emitter 访问
app.config.globalProperties.$emitter = emitter;

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(router)
app.use(ElementPlus)
app.use(createPinia())
app.mount('#app')